package com.example.kotlindemo

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class MyViewModel:ViewModel() {
    val number:MutableLiveData<Int> by lazy { MutableLiveData<Int>().also { it.value = 0 } }

    fun modifyNumber(aNumber: Int) {
        number.value = number.value?.plus(aNumber)   //如果number的值不为空，就进行plus  即加法   为空则停止操作   ！！ 强制执行
    }


}